package com.activititest.other;


import com.activititest.appentity.Response;
import com.activititest.entity.EmEnterprise;
import com.activititest.entity.EmEnterprise_RsBasEnterindustry;
import com.activititest.entity.RsBasEnterindustry;
import com.activititest.service.IEmEnterpriseService;
import com.activititest.service.impl.RsBasEnterindustryServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author mfx
 * @since 2020-10-16
 */
@RestController
@RequestMapping("/enterprise/")
public class RsBasEnterindustryController {
    @Autowired
    private IEmEnterpriseService emEnterpriseService;

    @Autowired
    private RsBasEnterindustryServiceImpl rsBasEnterindustryService;
    @PostMapping("/findenter_rsbas/")
    public Response<EmEnterprise_RsBasEnterindustry> findEnter_RsBas(@RequestParam("areaid")  int areaid){
        HashMap map=new HashMap();
        map.put("enterprise_area_id",areaid);
        List<EmEnterprise> list = (List<EmEnterprise>) emEnterpriseService.listByMap(map);
        QueryWrapper<RsBasEnterindustry> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("CODE_REGION","ENTERNAME","LONGITUDE","LATITUDE","ENTERADDRESS","CODE_SOURCE").eq("CODE_REGION",areaid);
        List<RsBasEnterindustry> list1 = rsBasEnterindustryService.list(queryWrapper);
        EmEnterprise_RsBasEnterindustry emEnterprise_rsBasEnterindustry = new EmEnterprise_RsBasEnterindustry();
        emEnterprise_rsBasEnterindustry.setEmEnterpriseList(list);
        emEnterprise_rsBasEnterindustry.setRsBasEnterindustryList(list1);
        Response euserResponse = new Response();
        euserResponse.setCode(200);
        euserResponse.setData(emEnterprise_rsBasEnterindustry);
        euserResponse.setMsg("yes");
        return euserResponse;
    }
}

